{literal}
<script language="JavaScript">
    function addArticleToPackage(myPackage){
        var mySelector = document.getElementById('addArticle');
        var myIndex    = mySelector.selectedIndex;
        var myArticles = document.getElementById('articles');
        
        showLoad();
        (new AjaxRequest).send({
    		url			: urlBase+"action=addArticleToPackage",
    		data		: {
    			id : mySelector.value,
    			pid: myPackage
    		},
    		
    		onSuccess	: function(data, info)
    		{
    		    if(data.added){
                    if(myArticles.innerHTML == 'n/a'){
                        myArticles.innerHTML = '<span id="art_'+mySelector.options[myIndex].value+'">'+mySelector.options[myIndex].text+' [<a href="javascript: dropArticleFromPackage('+mySelector.options[myIndex].value+','+myPackage+');" class="admin">x</a>]</span>';
                    }else{
                        myArticles.innerHTML = myArticles.innerHTML+'<span id="art_'+mySelector.options[myIndex].value+'">, '+mySelector.options[myIndex].text+' [<a href="javascript: dropArticleFromPackage('+mySelector.options[myIndex].value+','+myPackage+');" class="admin">x</a>]</span>';
                    }
                    
                    Fat.fade_element("art_"+mySelector.options[myIndex].value,10,1000,"#ffccff","#ffffff");
    		    }
    		    
    			
				hideLoad();				
    		}
    	});
    }
    
    function dropArticleFromPackage(aid,package){
        if(confirm('Are You Sure?')){
            deleteme('art_'+aid);
            showLoad();
            (new AjaxRequest).send({
                url			: urlBase+"action=dropArticleFromPackage",
                data		: {
                    id : aid,
                    pid: package
                },
                
                onSuccess	: function(data, info)
                {                    
                    deleteRow('art_'+aid);
                    hideLoad();				
                }
            });
        }
    }
</script>
{/literal}
<input type="text" name="title" class="textinput" value="{$page.title|sslash}" id="pageTitle" />
<label for="elm2">Teaser:</label>
<textarea id="elm2" name="teaser" class="tinymce" rows="15" cols="40" class="tinymce mceEditor">
   {$page.teaser|sslash}
</textarea><br />

<label for="upimg">Image (jpg only):</label>
{if $page.image == 't'}
    <br />
    <div class="nodeimgdiv" id="nodeimgdiv"><img src="{$INA.root}{$filePath}image/80x60.jpg" class="nodeimg" /><br />
    <a href="javascript: deleteImage('{$smarty.get.node}','{$smarty.get.id}');" class="admin">delete</a>
    <input type="hidden" name="img" id="img" value="1" />
    </div>        
    <input style="display: none" type="file" name="nodeimage" value="" id="upimg" class="textinput" style="width: 100%;" />
{else}
    <input type="file" name="nodeimage" value="" id="upimg" class="textinput" style="width: 100%;" />
{/if}
<br /><br />

<label for="elm1">Content:</label>    
<textarea id="elm1" name="content" rows="10" cols="40" class="tinymce mceEditor">
   {$page.content|sslash}
</textarea>
<div style="margin: 10px;">
    <div style="margin-bottom: 10px;"><strong>Articles in Package:</strong>
        <span id="articles">{foreach from=$inpack item=art name="mypack"}<span id="art_{$art.article_id}">{if !$smarty.foreach.mypack.first}, {/if}{$art.title} [<a href="javascript: dropArticleFromPackage({$art.article_id},{$page.pid});" class="admin">x</a>]</span>{foreachelse}n/a{/foreach}</span>
    </div>
    
    {if $articles}
    <div id="addArticleLayer">
        Add Article: 
        <select name="addArticle" id="addArticle">
            {html_options options=$articles}
        </select>
        <input type="button" onclick="addArticleToPackage({$page.pid});" value="Add" />
    </div>
    {/if}
    
    <div id="showOnSplash" style="margin-top: 15px;">
        Show Package on Splash Page: <input type="checkbox" name="on_splash" value="TRUE" {if $page.on_splash == 't'}checked{/if} />
    </div>
</div>